<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商品信息表格</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
        }

        .container {
            max-width: 900px;
            margin: 40px auto;
            padding: 20px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }

        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 20px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }

        th,
        td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }

        th {
            background-color: #4CAF50;
            color: white;
        }

        td {
            background-color: #f9f9f9;
        }

        .total-row {
            font-weight: bold;
            background-color: #f0f0f0;
        }

        .address-row td {
            background-color: #fff3e0;
        }

        .total-price {
            color: #d9534f;
            font-size: 1.2em;
        }

        .address {
            font-size: 14px;
            color: #555;
        }

        .address-box {
            border: 1px solid #ddd;
            padding: 10px;
            margin-top: 10px;
            border-radius: 8px;
            background-color: #fff;
        }
    </style>
</head>

<body>

   

<script>
    const name = prompt('请输入商品名称');
    const price = prompt('请输入商品价格');
    const count = prompt('请输入商品数量');
    const total = price * count;
    const address = prompt('请输入收货地址');
    
    document.write(`
        <div class="container">
        <h1>购物清单</h1>

        <table>
            <thead>
                <tr>
                    <th>商品名称</th>
                    <th>商品价格 (元)</th>
                    <th>商品数量</th>
                    <th>总价 (元)</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td class="name">${name}</td>
                    <td class="price">${price}</td>
                    <td class="num">${count}</td>
                    <td class="total-price">${total}</td>
                </tr>

                <tr class="total-row">
                    <td colspan="3">总价</td>
                    <td class="total-price">${total.toFixed(2)}</td>
                </tr>
            </tbody>
        </table>

        <div class="address-box">
            <h3>收货地址</h3>
            <div class="address">
                张三<br>
                <div class="address">${address}</div>
                100000<br>
                手机：13812345678
            </div>
        </div>
    </div>
    `)
</script>

</body>

</html>